package com.lagou.edu.pojo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration  //自定义配置类
@PropertySource("classpath:test.properties") //指定配置文件位置
@EnableConfigurationProperties(Person.class )

@ConfigurationProperties(prefix = "test")
public class Person {
    @Value("${test.id}")
    private Integer id;
    @Value("${test.age}")
    private String age;

    @Override
    public String toString() {
        return "Person{" +
                "id=" + id +
                ", age='" + age + '\'' +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }
}
